package com.gupaoedu.demo.mvc.action;

import com.gupaoedu.demo.service.IDemoService;
import com.gupaoedu.mvcframework.annotation.GPAutowired;
import com.gupaoedu.mvcframework.annotation.GPController;
import com.gupaoedu.mvcframework.annotation.GPRequestMapping;
import com.gupaoedu.mvcframework.annotation.GPRequestParam;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author: WFP
 * @Time: 2018/1/27
 * @decription:
 */
@GPController
@GPRequestMapping("/web")
public class DemoAction {
    @GPAutowired
    IDemoService demoService;

    @GPRequestMapping("/query.json")
    public void query(HttpServletRequest req , HttpServletResponse resp,@GPRequestParam("name") String name){
        String result = demoService.get(name);
        try{
            resp.getWriter().write(result);
        }catch (IOException e){
            e.printStackTrace();
        }
    }

    @GPRequestMapping("/remove.json")
    public void remove(HttpServletRequest req , HttpServletResponse resp,String name){

    }

    @GPRequestMapping("/modify.json")
    public void modify(HttpServletRequest req , HttpServletResponse resp,String name){

    }
}
